/* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

link
链接相关接口

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/

#import <Foundation/Foundation.h>
#import <JDCloudOCSDKPortal/PortalApiModel.h>


@implementation PortalDescribeProductRequest
-(id) initWithRegion:(NSString *)regionId
url:(NSString*)url
lang:(NSString*)lang
ak:(NSString*)ak { 
    self.regionId = regionId;
    self.url = url;
    self.lang = lang;
    self.ak = ak;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
url:(NSString*)url
lang:(NSString*)lang
ak:(NSString*)ak { 
    self.regionId = regionId;
    self.version = version;
    self.url = url;
    self.lang = lang;
    self.ak = ak;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self url])
    {
        [result setValue:[self url] forKey:@"url"];
    }
    if([self lang])
    {
        [result setValue:[self lang] forKey:@"lang"];
    }
    if([self ak])
    {
        [result setValue:[self ak] forKey:@"ak"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.url = [dictionary objectForKey:@"url"];
    self.lang = [dictionary objectForKey:@"lang"];
    self.ak = [dictionary objectForKey:@"ak"];
    return self;
} 

@end
@implementation PortalDescribeProductsByIdRequest
-(id) initWithRegion:(NSString *)regionId
idValue:(NSNumber*)idValue
ak:(NSString*)ak { 
    self.regionId = regionId;
    self.idValue = idValue;
    self.ak = ak;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
idValue:(NSNumber*)idValue
ak:(NSString*)ak { 
    self.regionId = regionId;
    self.version = version;
    self.idValue = idValue;
    self.ak = ak;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    if([self ak])
    {
        [result setValue:[self ak] forKey:@"ak"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    self.ak = [dictionary objectForKey:@"ak"];
    return self;
} 

@end
@implementation PortalDescribeProductsByIdResult
-(id) initWithResult:(NSArray<Navigation*>*) result { 
    self.result = result;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self result])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self result] count]; i++) {
            Navigation* item = [[self result] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"result"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    NSArray* resultArray = [dictionary objectForKey:@"result"];
    if(resultArray&&![resultArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [resultArray count];i++)
        {
        Navigation* item = [[Navigation alloc]initWithDic:[resultArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.result = propertyArray;
    }
    return self;
} 

@end
  
@implementation PortalDescribeProductsByIdResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
PortalDescribeProductsByIdResult* result = [[PortalDescribeProductsByIdResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(PortalDescribeProductsByIdResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation PortalDescribeProductResult
-(id) initWithResult:(Product*) result { 
    self.result = result;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self result])
    {
        [result setValue:[[self result] dictionary]forKey:@"result"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.result = [[Product alloc]initWithDic:[dictionary objectForKey:@"result"]];
    return self;
} 

@end
  
@implementation PortalDescribeProductResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
PortalDescribeProductResult* result = [[PortalDescribeProductResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(PortalDescribeProductResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
 
